import { AudioClip, Color, JsonAsset, Prefab, SpriteFrame, Vec3 } from "cc";
import { LevelInfo } from "./GlobaInterface";

/**
 * 游戏全局数据
 */
export class GlobalData {

    //游戏分数
    static GameScore: number = 0;

    //金币数量
    static GameCoin: number = 0;

    //游戏结束
    static GameOver: boolean = false;

    //是否是广告
    static IsAd: boolean = false;

    //汽车携带子弹数
    static CarButtle: number[] = [4, 6, 8];

    //当前关卡
    static CurrentLevel: number = 0;

    //龙身体信息
    static DragonBodyInfo: number[] = [];

    //喵咪边界
    static CarBound = {
        left: -400,
        right: 400,
        top: 400,
        bottom: -400
    }

    //是否可以点击车
    static CanClickCar: boolean = true;

    //子弹速度
    static ButtleSpeed: number = 10;

    //是否碰撞
    static IsHit: boolean = false;

    //身体移动速度插值
    static BodyAddSpeed: number = 50;
    //发射范围
    static FireRange: number = 0;

}

/**
 * 资源列表
 */
export const GAME_RES = {
    BundleName: "GAME_RES",//资源包名称
    Asset: {//资源列表
        Prefabs: { path: "Prefab", type: Prefab },
        Sounds: { path: "Sound", type: AudioClip },
        SpriteFrames: { path: "SpriteFrame", type: SpriteFrame },
        Jsons: { path: "Json", type: JsonAsset }
    }
}

/**
 * 游戏预设体
 */
export const GAME_PREFAB = {
    DragonBody: "DragonBody",//龙的身体
    SingleGun: 'SingleGun',//单个炮台
    CarBody: "game_carbody",//单个汽车
    SingleButtle: "SingleButtle",//单个子弹
    SingleEffect: "SingleEffect",//单个特效
    PopSingleCollect: "PopSingleCollect",//单个收藏品
    PopHeadSkin: "PopHeadSkin"
}

/**
 * 游戏场景
 */
export const GAME_SCENE = {
    LoginScene: "LoginScene",
    GameScene: "GameScene"
}

/**
 * 游戏弹窗
 */
export const GAME_POP = {
    PopSet: "PopSet",
    PopSkin: "PopSkin",
    PopAd: "PopAd",
    PopEnd: "PopEnd",
    PopBuy: 'PopBuy',
    PopStart: 'PopStart',
    PopCollect: "PopCollect",
    PopLevel: "PopLevel"
}

/**
 * 游戏顶层弹窗
 */
export const GAME_TOP = {
    TopPromptText: 'TopPromptText'
}

/**
 * 音效分类
 */
export const SOUND_TYPE = {
    Button: "anniu",
    Bg: "music",
    Fire: "arma3a",
    Hit: "boomsound",
    HitCar: "luodi",
    Pass: "prop_music",
    Fail: "chaoxiao",
    CarMove: "startupsound"
}

/**
 * 游戏纹理
 */
export const GAME_SPRITEFRAME = {
    DragonBody: "game_birdbody",
    DragonHead: "game_bridhead",
    Gun: "game_catbody",
    Buttle: "game_buttle",
    Wing: "birdwing",
    Collect: "collect",
    Line: "line"
}


export const CarColorArr = [
    new Color(61, 192, 125, 255),
    new Color(255, 250, 255, 255),
    new Color(64, 62, 62, 255),
    new Color(245, 189, 69, 255),
    new Color(251, 240, 128, 255),
    new Color(50, 149, 149, 255),
    new Color(255, 192, 203, 255),
]

/**
 * 关卡配置
 */
export const LevelConfig: LevelInfo[] = [
    {
        index: 0,
        speed: 75,
        line: 0,
        carpos: 1
    },
    {
        index: 1,
        speed: 75,
        line: 0,
        carpos: 2
    },
    {
        index: 2,
        speed: 75,
        line: 0,
        carpos: 3
    },
    {
        index: 3,
        speed: 100,
        line: 0,
        carpos: 4
    },

    {
        index: 4,
        speed: 75,
        line: 1,
        carpos: 3
    },
    {
        index: 5,
        speed: 100,
        line: 1,
        carpos: 4
    },

    {
        index: 6,
        speed: 75,
        line: 2,
        carpos: 3
    },
    {
        index: 7,
        speed: 100,
        line: 2,
        carpos: 4
    },

    {
        index: 8,
        speed: 75,
        line: 3,
        carpos: 3
    },
    {
        index: 9,
        speed: 100,
        line: 3,
        carpos: 4
    },

    {
        index: 10,
        speed: 75,
        line: 2,
        carpos: 4
    },
    {
        index: 11,
        speed: 75,
        line: 3,
        carpos: 4
    }
]







